package com.yc.common.utils;

import java.io.PrintWriter;
import java.io.StringWriter;

/**
 * @Classname ThrowableUtil
 * @Description TODO
 * @Version 1.0.0
 * @Date 2022/8/15 15:51
 * @Created by Mikechen
 */
public class ThrowableUtils {
    /**
     * 获取堆栈信息
     */
    public static String getStackTrace(Throwable throwable){
        StringWriter sw = new StringWriter();
        try (PrintWriter pw = new PrintWriter(sw)) {
            throwable.printStackTrace(pw);
            return sw.toString();
        }
    }
}
